package com.societyGames.codeAlong.state.codeExercise.model
{
	public class Exception
	{
		private var _error:Error;
		private var _stackTraceMessage:StackTraceMessage; //may be null if not on debug player.

		public function get error():Error
		{
			return this._error;
		}
		
		public function get stackTraceMessage():StackTraceMessage //may be null if not on debug player.
		{
			return this._stackTraceMessage;
		}
		
		public static function fromError(error:Error):Exception
		{
			var exception:Exception = new Exception();
			exception._error = error;
			var stackTraceText:String = error.getStackTrace();
			if (stackTraceText != null)
			{
				exception._stackTraceMessage = StackTraceMessage.fromString(stackTraceText);
			}
			return exception;
		}
	}
}